CREATE TABLE [dbo].[SCU](
	[SCUId] [int] IDENTITY(1,1) NOT NULL,
	[ClientId] [varchar](50) NULL,
	[SCUName] [varchar](500) NOT NULL,
	[SCUGroup] [varchar](100) NOT NULL,
	[SCUSubGroup] [varchar](100) NOT NULL,
	[IsDelete] [bit] NOT NULL,
	[LastUpdateUserName] [varchar](50) NULL,
	[LastUpdateDateTime] [datetime] NULL,
 CONSTRAINT [PK_SCU] PRIMARY KEY CLUSTERED 
(
	[SCUId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[SCU] ADD  CONSTRAINT [DF_SCU_IsDelete]  DEFAULT ((0)) FOR [IsDelete]
GO
create PROCEDURE spSCU_Delete
(
	@SCUId varchar(max)
)
AS
BEGIN
	set nocount on
	set xact_abort on
	
	update SCU
	set IsDelete = 1, ClientId = null
	where SCUId in (select CONVERT(int, Item) as SCUId from dbo.fnStringSplit(@SCUId, ';') as vw)
END
go


